package com.changgou.goods.dao;

import com.changgou.goods.pojo.Spec;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface SpecMapper extends Mapper<Spec> {

    @Select("SELECT\n" +
            "\ts.name,\n" +
            "\ts.options \n" +
            "FROM\n" +
            "\ttb_spec s\n" +
            "\tINNER JOIN tb_template t ON s.template_id = t.id\n" +
            "\tINNER JOIN tb_category c ON c.template_id = t.id \n" +
            "WHERE\n" +
            "\tc.NAME = #{name}")
    List<Map> findSpecByCategory(@Param("name") String queryString);
}
